﻿using HTB.DevFx;
using Maple.Weixin.MP.Entities.Messages;

namespace Maple.Weixin.MP.Web
{
    public class MyMessageBus : MessageBus
    {
        protected override IResponseService DefaultService(RequestMessageBase requestMessage) {
            return ObjectService.GetObject<GettingRequestMessageTypeService>();
        }

        protected override IResponseService OnTextRequest(RequestMessageText requestMessage) {
            HTB.DevFx.Log.LogService.WriteLog(requestMessage.Content);
            if (requestMessage.Content == "@@") {
                return new ResponseNothing();
            }
            if (requestMessage.Content == "12") {
                return new ResponseText("aaa");
            }
            if (requestMessage.Content.ToUpper() == "@OPENID") {
                return new ResponseText(requestMessage.FromUserName);
            }
            return new ResponseText("bbb");
        }

        //protected override IResponseService OnEventTemplateSendJobFinishRequest(RequestMessageEventTemplateSendJobFinish requestMessage) {
        //    HTB.DevFx.Log.LogService.WriteLog(requestMessage.SendResult.ToString());
        //    return new ResponseNothing();
        //}
    }
}